package cn.kgc.itrip.biz.controller;

import cn.kgc.itrip.beans.common.ServerResponse;
import cn.kgc.itrip.biz.service.IHotelService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 阿泽
 */
@Controller
@RequestMapping("/api/hotel")
public class HotelController {
    @Resource
    private IHotelService iHotelService;

    /**
     * 查询商圈
     *
     * @param cityId
     * @return
     */
    @RequestMapping(value = "/querytradearea/{cityId}", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse querytradearea(@PathVariable Integer cityId) {
        return iHotelService.queryTradeList(cityId);
    }

    /**
     * 获取酒店图片 默认type 0
     *
     * @param targetId
     * @return
     */
    @RequestMapping(value = "/getimg/{targetId}", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse getimg(@PathVariable Integer targetId) {
       /* if(targetId==1){
            return iHotelService.queryHotelImage(targetId, "1");
        }else if (targetId==2){
            return iHotelService.queryHotelImage(targetId, "2");
        }*/
        return iHotelService.queryHotelImage(targetId, "0");
    }

    /**
     * 根据酒店id查询酒店特色、商圈、酒店名称
     *
     * @param hotelId
     * @return
     */
    @RequestMapping(value = "/getvideodesc/{hotelId}", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse getvideodesc(@PathVariable String hotelId) {
        return iHotelService.queryHoteDesc(hotelId);
    }

    /**
     * / queryhotelfacilities / {id}
     * 根据酒店ID查询酒店设施
     */
    @RequestMapping(value = "/queryhotelfacilities/{id}", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse queryhotelfacilities(@PathVariable Integer id) {
        return iHotelService.queryhotelfacilities(id);
    }

    /**
     * 查询酒店特色列表
     * GET /api/hotel/queryhotelfeature
     */

    @RequestMapping(value = "/queryhotelfeature", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse queryhotelfacilities() {
        return iHotelService.queryhotelfeature();
    }

    /**
     * 查询热门城市
     * GET /api/hotel/queryhotcity/{type}
     */
    @RequestMapping(value = "/queryhotcity/{type}", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse queryhotcity(@PathVariable Integer type) {
        return iHotelService.queryhotcity(type);
    }

    /**
     * 根据酒店id查询酒店特色和介绍
     * GET /api/hotel/queryhoteldetails/{id}
     */
    @RequestMapping(value = "/queryhoteldetails/{id}", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse queryhoteldetails(@PathVariable Integer id) {
        return iHotelService.queryhoteldetails(id);
    }
    /**
     * /queryhotelpolicy/{id}
     * 根据酒店id查询酒店政策
     */
    @RequestMapping(value = "/queryhotelpolicy/{id}", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse queryhotelpolicy(@PathVariable Integer id) {
        return iHotelService.queryhotelpolicy(id);
    }


}
